package com.hsh.erp.controller;

import com.hsh.erp.domain.common.Result;
import com.hsh.erp.domain.dto.OrderDTO;
import com.hsh.erp.domain.vo.OrderVO;
import com.hsh.erp.service.OrderService;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author USER
 * @description 针对表【order】的数据库操作Service实现
 * @createDate 2024-05-30 16:21:43
 */
@RestController
@RequestMapping("/order")
@Tag(name = "订单", description = "订单")
public class OrderController {

    @Resource
    private OrderService orderService;

    /**
     * 列表查询
     *
     * @param orderVO
     * @return
     */
    @GetMapping("/list")
    @Operation(summary = "列表查询")
    public Result<List<OrderDTO>> getList(OrderVO orderVO) {
        return orderService.getList(orderVO);
    }

    /**
     * 修改一条记录
     *
     * @param orderVO
     * @return
     */
    @PostMapping("/updateOne")
    @Operation(summary = "修改一条记录")
    public Result updateOne(@RequestBody OrderVO orderVO) {
        return orderService.updateOne(orderVO);
    }

    /**
     * 删除一条记录
     *
     * @param id
     * @return
     */
    @PostMapping("/deleteOne")
    @Operation(summary = "删除一条记录")
    public Result deleteOne(@RequestBody OrderVO orderVO) {
        return orderService.deleteOne(orderVO);
    }

    /**
     * 新增一条记录
     *
     * @param orderVO
     * @return
     */
    @PostMapping("/addOne")
    @Operation(summary = "新增一条记录")
    public Result addOne(@RequestBody OrderVO orderVO) {
        return orderService.addOne(orderVO);
    }

    /**
     * 批量新增记录
     *
     * @param orderVOList
     * @return
     */
    @PostMapping("/addList")
    @Operation(summary = "批量新增记录")
    public Result addList(@RequestBody List<OrderVO> orderVOList) {
        return orderService.addList(orderVOList);
    }


}




